#include <Ogre.h>
using namespace Ogre;
#include <math.h>

#define PI 3.14159265358979323846

Quaternion mySlerp (Quaternion p, Quaternion q, double t) {

  Quaternion res;
  Vector3 v1 (p.x, p.y, p.z), v2 (q.x, q.y, q.z);
  
  double phi = v1.angleBetween(v2).valueRadians();
  res = (p*(sin((1-t)*phi)/sin(phi))) + (q*(sin(t*phi)/sin(phi)));
  
  return res;

}
